package com.tian.controller.api;

import com.tian.annotation.LoginCheckAnnotation;
import com.tian.annotation.MethodInvokeLogAnnotation;
import com.tian.common.CommonResult;
import com.tian.common.PageResult;
import com.tian.dto.message.*;
import com.tian.service.ChargeSystemMessageService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * {@code @description:} 我的站内信
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-08-07 17:53
 * {@code @version:} 1.0
 */
@RestController
@RequestMapping("/api/system/message")
@Api(tags = "我的站内信 控制器")
public class ChargeSystemMessageController {

    @Resource
    private ChargeSystemMessageService chargeSystemMessageService;

    @LoginCheckAnnotation
    @PostMapping("/update")
    public CommonResult<Boolean> update(ChargeSystemMessageUpdateReqDto chargeSystemMessageUpdateReqDto){
        return chargeSystemMessageService.update(chargeSystemMessageUpdateReqDto);
    }

    @LoginCheckAnnotation
    @GetMapping("/page")
    public  CommonResult<PageResult<List<ChargeUserSystemMessageRespDto>>> page(ChargeSystemMessagePageReqDto chargeSystemMessagePageReqDto){
        return chargeSystemMessageService.page(chargeSystemMessagePageReqDto);
    }

    @LoginCheckAnnotation
    @GetMapping("/{id}")
    public  CommonResult<ChargeUserSystemMessageRespDto> findById(@PathVariable("id") Long id){
        return chargeSystemMessageService.findById(id);
    }

    @LoginCheckAnnotation
    @DeleteMapping("/delete")
   public CommonResult<Boolean> delete(@RequestParam Long id){
        return chargeSystemMessageService.delete(id);
   }
}
